home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 March
/
Amiga-CD 1996 #3.iso
/
demos
/
stormc-demo
/
examples
/
fplot
/
fclass.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-19
|
1KB
|
63 lines
// Class-Definitionen:
class Func
{ static double Dummy;
public:
virtual double eval(double) = 0;
virtual void print(char*) = 0;
virtual ~Func();
virtual int isconst(double &val = Dummy);
};
class KonstN: public Func
{ double Konst;
public:
double eval(double)
{ return Konst; }
int isconst(double &);
KonstN(double);
void print(char*);
};
class VarN: public Func
{ public:
double eval(double x)
{ return x; }
void print(char*);
};
class ErrorN: public Func
{ public:
double eval(double)
{ return 1; }
void print(char*);
};
enum UnOps { Op_neg, Op_sqr, Op_sqrt, Op_sin, Op_cos, Op_exp, Op_ln};
enum BinOps { Op_add, Op_sub, Op_mult, Op_div, Op_pot };
class UnOpN: public Func
{ UnOps oper;
Func *arg;
public:
double eval(double);
UnOpN(UnOps, Func*);
void print(char*);
~UnOpN();
};
class BinOpN: public Func
{ BinOps oper;
Func *l, *r;
public:
double eval(double);
BinOpN(BinOps, Func*, Func*);
void print(char*);
~BinOpN();
};
Func *Parse(char*);